unit UStern;

interface

uses SysUtils, Windows, Classes, Math, UMapObjekte, UPictureName, UPlayer;

type
  TStern = class(TMapObject) // 10
  private
    Used: boolean;
  public
    constructor Create(Id: integer); Override;
    function getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
      Override;
  end;

implementation

uses UGame;
{ TStern }

constructor TStern.Create(Id: integer);
begin
  self.Id := Id;
  self.Num := 10;
  FPictureName := b_Stern;
  Used := False;
  self.affgravity := False;
end;

function TStern.getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
var
  vgame: TGame;
begin
  vgame := Game as TGame;
  if ((vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = RGB(250, 0, 250)) or
      (vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = -1)) or (self.Used) then
    result := 0
  else
  begin
    result := 1;
    self.FEndeX := self.StartX;
    self.FEndeY := self.StartY;
    vgame.SetImmortarl(self);
    self.Used := True;
    self.FPictureName := null;
    if Assigned(self.OnMove) then
      self.OnMove(self);
    if vgame.IsClient then
      vgame.objectmove(self);
  end;
end;

end.
